-
Notifications
You must be signed in to change notification settings - Fork 1.4k
fix: chat fails to load older messages when scrolling to the top #6861
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughRemoved the COUNT_LIMIT usage in loadMessagesForRoom.ts, replaced comparisons to use COUNT directly, set fetch param Changes
Sequence Diagram(s)Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Organization UI Review profile: CHILL Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
✏️ Tip: You can disable this entire section by setting Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Jira integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
app/lib/methods/loadMessagesForRoom.ts
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: ESLint and Test / run-eslint-and-test
| import { generateLoadMoreId } from './helpers/generateLoadMoreId'; | ||
|
|
||
| const COUNT = 50; | ||
| const COUNT_LIMIT = COUNT * 10; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've done this for a reason…
A few months ago, we had an issue with large threads being used as the last message.
If you test a thread with more than 100 replies as the last message in develop and in this branch, you'll see that this change rolls back the fix.
| develop | your branch |
|---|---|
![]() |
![]() |
We must find a smart way to make it work without overloading in long-thread cases, if you want we can try to find a solution together on DM.
|
Android Build Available Rocket.Chat Experimental 4.69.0.108033 Internal App Sharing: https://play.google.com/apps/test/RQVpXLytHNc/ahAO29uNTMn9vAH5bv36c_nUXlxopRYNCViAP4C0siFgZb8Ka-PDBpZa0PW3tjssnWCtTL5VEF1zlDncpoeeWWeclS |
|
iOS Build Available Rocket.Chat Experimental 4.69.0.108129 |
OtavioStasiak
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
Great job!


Proposed changes
This PR fixes an issue where scrolling to the top of a DM or Room chat would get stuck and fail to load older messages.
To fix this, I observed how the web handles message loading and found that it only loads room level messages while excluding thread messages. Thread messages are fetched only when navigating into a thread. I applied the same behavior in the app to ensure consistent pagination and prevent message loading from getting stuck.
Issue(s)
https://rocketchat.atlassian.net/browse/CORE-1701
How to test or reproduce
Expected Behaviour
It should load previous messages
Actual Behaviour
It just stuck on top
Screenshots
Types of changes
Checklist
Further comments
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.